<?php

use Ethereum\HecoApi;
use Ethereum\HRC20;

require_once WEB_PATH ."/../vendor/heco/autoload.php";

class Heco20{


    const CONTRACT_ADDRESS = '';
    const HECO_KEY = '';
    const WALLET_PRIVATE_KEY = '';
    const WALLET_ADDRESS = '';

    private function getHRC20($contractAddress = self::CONTRACT_ADDRESS){

        $HRC20 = new HRC20($contractAddress, 2, new HecoApi(self::HECO_KEY, 'heco-main'));
        return $HRC20;
    }

    public function testBalanceApi()
    {
        $res = $this->getHRC20()->balanceByApi(self::WALLET_ADDRESS);
        var_dump($res);
    }

    public function balance()
    {
        $res = $this->getHRC20()->balance(self::WALLET_ADDRESS);
        var_dump($res);

    }

    public function testTransfer() {
        $res = $this->getHRC20()->transfer(
            self::WALLET_PRIVATE_KEY,
            '0x4D1b9a7cB13d2820a5135312C9884Cdf76b17eE4',
            1
        );
        var_dump($res);
    }
}
?>